function SpPanelCallback(){
    var _hashParameter = Library.WebControl.Hashtable.CreateHashtable();
    var _instance = this;
    var _util = Library.WebControl.Util;
    var _id;
    this.AddParameter = function(k, v){
        _hashParameter.Add(k, v);
    };
    this.Init = function( clientName, id){
        _id = id;
        _globalHashObject.Add(clientName, _instance);
        window[clientName] = _instance;
    };
    function callbackComplete(s, e){
        var r = _util.ParseAjaxResponse(e.ResponseText);
        r.Parameter = s.P;
        if (!r.IsValid) {
            alert(r.Result);
        }
        else {
            _util.EvalScriptAndHtml(r.Data, _id);
        }
        if (s.F && typeof(s.F) == "function") 
            s.F(_instance, r);
    };
    
    this.SendCallback = function(parameter, callbackFunction){
        var ajaxRequest = Library.WebControl.Ajax.CreateRequest();
        ajaxRequest.SetData('__SPPANELCALLBACKRQP_=T&__SPPANELCALLBACKF_=C&__SPPANELCALLBACKD_=' + encodeURIComponent(parameter) + '&__SPPANELCALLBACKS_=' + _id + '&' + _hashParameter.ToQuery());
        _hashParameter.Clear();
        ajaxRequest.SendCallback({
            P: parameter,
            F: callbackFunction
        }, callbackComplete);
    };
};
